var Signup = {
	flag: false,
	init: function() {
		// Zycon("signup_content", $("#content").offset().top);
	},
	lgn: function() {
		if (!Core.check())
			return;
		var email = $("#email").val();
		var pwd = $("#pwd").val();
		$ajax({
			url: "/user/lgn",
			data:{value:email, pwd:pwd},
			success: function(res) {
				if (res.result[0].category != Role.STUDENT)
					return $alert("您的身份不是学生，只有学生才能登入");
				SetLS("user", res.result[0]);
				CurrentUser = GetLS("user");
				PCall("root","Index.userInit();");
				$("#email, #pwd").blur();
				if (GetLS("tab").url == "tab3")
					OpenNewWin("tab3");
				else
					OpenNewWin('father',5);
			}
		});
	},
	phoneCode: function() {
		if (Signup.flag)
			return;
		var phone = $("#phone").val();
		if (phone == "") {
			return $alert("手机不能为空");
		}
		if (phone.length != 11) {
			return $alert("手机格式错误");
		}

		Signup.flag = true;
		$("#phoneBtn").text("120秒");
		var tmo = setInterval(function(){
			var num = parseInt($("#phoneBtn").text().replace("秒", ""));
			--num;
			if (num == 0) {
				Signup.flag = false;
				clearInterval(tmo);
				$("#phoneBtn").text("获取验证码");
			} else {
				$("#phoneBtn").text(num + "秒");
			}
		}, 1000);
		$ajax({
			url:"/user/verify",
			data:{PHONE:phone}
		});
	},
	guideClose: function(){ 
		//if ($("#never").prop("checked"))
		SetLS("never","never");
		if (GetLS("user"))
  			OpenNewWin('index',5);
  		else
  			OpenNewWin("signup",5);
	}
}